package com.ruoyi.paas.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.paas.mapper.XspUserSiginLogMapper;
import com.ruoyi.paas.domain.XspUserSiginLog;
import com.ruoyi.paas.service.IXspUserSiginLogService;
import com.ruoyi.common.core.text.Convert;

/**
 * 用户签到记录Service业务层处理
 *
 * @author zhiminhu
 * @date 2021-04-26
 */
@Service
public class XspUserSiginLogServiceImpl implements IXspUserSiginLogService {
    @Autowired
    private XspUserSiginLogMapper xspUserSiginLogMapper;

    /**
     * 查询用户签到记录
     *
     * @param id 用户签到记录ID
     * @return 用户签到记录
     */
    @Override
    public XspUserSiginLog selectXspUserSiginLogById(Long id) {
        return xspUserSiginLogMapper.selectXspUserSiginLogById(id);
    }

    /**
     * 查询昨天是否有签到
     *
     * @param userCode
     * @return
     */
    @Override
    public XspUserSiginLog selectXspUserSiginLogForYesterdayByUserCode(Long userCode) {
        return xspUserSiginLogMapper.selectXspUserSiginLogForYesterdayByUserCode(userCode);
    }
    /**
     * 查询今天是否有签到
     * @param userCode
     * @return
     */
    @Override
    public XspUserSiginLog selectXspUserSiginLogForTodayByUserCode(Long userCode){
        return xspUserSiginLogMapper.selectXspUserSiginLogForTodayByUserCode(userCode);
    }
    /**
     * 查询用户签到记录列表
     *
     * @param xspUserSiginLog 用户签到记录
     * @return 用户签到记录
     */
    @Override
    public List<XspUserSiginLog> selectXspUserSiginLogList(XspUserSiginLog xspUserSiginLog) {
        return xspUserSiginLogMapper.selectXspUserSiginLogList(xspUserSiginLog);
    }

    /**
     * 新增用户签到记录
     *
     * @param xspUserSiginLog 用户签到记录
     * @return 结果
     */
    @Override
    public int insertXspUserSiginLog(XspUserSiginLog xspUserSiginLog) {
        xspUserSiginLog.setCreateTime(DateUtils.getNowDate());
        return xspUserSiginLogMapper.insertXspUserSiginLog(xspUserSiginLog);
    }

    /**
     * 修改用户签到记录
     *
     * @param xspUserSiginLog 用户签到记录
     * @return 结果
     */
    @Override
    public int updateXspUserSiginLog(XspUserSiginLog xspUserSiginLog) {
        xspUserSiginLog.setUpdateTime(DateUtils.getNowDate());
        return xspUserSiginLogMapper.updateXspUserSiginLog(xspUserSiginLog);
    }

    /**
     * 删除用户签到记录对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteXspUserSiginLogByIds(String ids) {
        return xspUserSiginLogMapper.deleteXspUserSiginLogByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用户签到记录信息
     *
     * @param id 用户签到记录ID
     * @return 结果
     */
    @Override
    public int deleteXspUserSiginLogById(Long id) {
        return xspUserSiginLogMapper.deleteXspUserSiginLogById(id);
    }
}
